import 'package:flutter/material.dart';
import 'package:flutter_project/common/route_page/route_name.dart';
import 'package:flutter_project/config/app_bar_view.dart';
import 'package:flutter_project/config/theme_color.dart';

import 'notice_set_page.dart';

class SystemNoticeListPage extends StatefulWidget {
  const SystemNoticeListPage({super.key});

  @override
  State<SystemNoticeListPage> createState() => _SystemNoticeListPageState();
}

class _SystemNoticeListPageState extends State<SystemNoticeListPage> {
  @override
  Widget build(BuildContext context) {
    return CommonAppWidget.navAppBar(
      title: '系统通知',
      rightActions: [
        GestureDetector(
          onTap: () {
            RouteNames.push(const NoticeSetPage());
          },
          child: Container(
            padding: const EdgeInsets.only(right: 10),
            child: const Text(
              '系统设置',
              style: TextStyle(fontSize: 15),
            ),
          ),
        )
      ],
      childWidget: ListView.builder(
          padding: const EdgeInsets.only(top: 10),
          itemCount: 10,
          itemBuilder: (BuildContext context, int index) {
            return Container(
              margin: const EdgeInsets.only(left: 10, right: 10, bottom: 10),
              padding: const EdgeInsets.only(
                  left: 10, right: 10, top: 10, bottom: 10),
              decoration: BoxDecoration(
                borderRadius: BorderRadius.circular(10),
                color: Colors.white,
              ),
              child: Column(
                crossAxisAlignment: CrossAxisAlignment.start,
                children: [
                  const Text(
                    '爱诗用户服务协议修订通知',
                    style: TextStyle(fontWeight: FontWeight.w600, fontSize: 16),
                  ),
                  const SizedBox(
                    height: 5,
                  ),
                  Text(
                    '2024-01-12 16:00',
                    style: TextStyle(
                        color: ThemeColor.textColorSecond, fontSize: 12),
                  ),
                  const SizedBox(
                    height: 5,
                  ),
                  Text(
                    '你好，根据业务开展的实际情况，爱诗近期更新了《“爱诗”隐私政策》中的相关内容。你可以前往“我”-“设置”页面查看更新后的协议全文。',
                    style: TextStyle(
                      color: ThemeColor.textColor,
                      fontSize: 14,
                    ),
                  ),
                ],
              ),
            );
          }),
    );
  }
}
